//--------------------------------------------------------------------------------------
/// this function take a list of variable names and files names.
/// if the variable is not defined it imports the files
/// if the variable is defined it does nothing
function importFiles( arrayOfNamesAndFiles )
{
    if( arrayOfNamesAndFiles.length > 0 )
    {
        if( window['STATIC_URL_JS'] == undefined )
        {
            alert('you need to define te STATIC_URL_JS variable as the url to the static files');
        }
        // get the heat to add the script to
        var head = document.getElementsByTagName('head').item(0);
        // add all the scripts when necessary
        for( var variableToCheck = 0; variableToCheck  < arrayOfNamesAndFiles.length; ++variableToCheck )
        {
            alert( window[arrayOfNamesAndFiles[variableToCheck][0]] == undefined);
            if( window[arrayOfNamesAndFiles[variableToCheck][0]] == undefined )
            {
                var script = document.createElement('script');
                script.type = 'text/javascript';
                script.src = STATIC_URL_JS+arrayOfNamesAndFiles[variableToCheck][1];
                script.defer = false;
                head.appendChild(script);
            }
        } 
    }
    return false;
}
